/**
   将字符串 abcdefkgmnt 反序输出   tnmgkfedcba
           0123456
           chatAt(0)
           str[1]
           length



 */
let str = 'javascript'

function reversString(str) {
	let reversed = ' '
	for (let i = str.length - 1; i >= 0; i--) {
		reversed += str[i]
	}
	return reversed
}

// var revers = reversString(str)
function reversTowString(str) {
	// const array1 = ['j', 'a', 'v', 'a', 's']
	// console.log(array1.reverse())
	// const str1 = 'hello'

	// const words = str1.split('')
    // console.log(words.join());

    var arr = str.split('')
    var newArr = arr.reverse()
    var newStr = newArr.join('')
    return newStr
}

 console.log(  reversTowString(str));

